package com.zzyl.controller;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.dto.AlertDataPageQueryDto;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Slf4j
@Api(value = "预警数据")
@RequestMapping("/alert-data")
public class AlertDataController {

    @Resource
    private AlertDataService service;

    @ApiOperation(value = "分页查询预警数据")
    @GetMapping("/pageQuery")
    public ResponseResult<AlertDataVo> query(AlertDataPageQueryDto dto) {
        return ResponseResult.success(service.selectByPage(dto));
    }

    @ApiOperation(value = "处理预警数据")
    @PutMapping("/handleAlertData/{id}")
    public ResponseResult handleAlertData(@PathVariable Long id,
                                          @RequestBody AlertDataHandleDto dto) {
        service.handleAlertData(id,dto);
        return ResponseResult.success();
    }

}
